<?php
/**
 * Created by PhpStorm.
 * User: yandian
 * Date: 2017/4/25
 * Time: 14:09
 */

namespace app\weixin\controller;


use app\common\controller\LiteBase;

class LoveCertificate extends LiteBase
{

    private function getData()
    {
        $rows = \app\common\model\LoveCertificate::instance()->gotoPage()->alias('c')
            ->join('donation d', 'c.donation_id=d.id')
            ->field('c.*,d.money')
            ->order('id desc')->select();
        foreach ($rows as &$row) {
            $row['create_time'] = ccnn_dateformat2($row['create_time']);
            $row['money'] = number_format($row['money'] / 100, 2);
        }
        return $rows;
    }

    public function index()
    {
        $this->assign('m', $this->getData());
        return $this->fetch();
    }

    public function jsonList()
    {
        return $this->jsonSuccess($this->getData());
    }

}